<template>
  <div class="header-box">
    <div class="header-menu">
      <div class="title">零零后的人</div>
      <div class="list">
        <ul class="list-ul">
          <li class="active">首页</li>
          <li>技术</li>
          <li>生活</li>
          <li>未来</li>
          
        </ul>
      </div>
    </div>

    <!-- 头部功能区域 -->
    <div class="header-search">
      <div class="search-box">
        <i class="el-icon-search"></i>
        <input
          type="text"
          placeholder="请输入文章名"
          v-model="searchName"
          @change="handleSearch"
        />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "comHeader",
  data() {
    return {
      searchName: "",
    };
  },
  methods: {
    // 搜索事件
    handleSearch() {
      console.log(this.searchName);
    },
  },
};
</script>

<style lang="scss" scoped>
.header-box {
  width: 100%;
  height: 80px;
  background: #353f4f;
  padding: 0px 180px;
  color: #fff;

  display: flex;
  justify-content: space-between;
  align-items: center;

  .header-menu {
    display: flex;
    font-size: 24px;

    .title {
      margin-right: 100px;
    }

    .list {
      .list-ul {
        display: flex;

        li {
          margin-right: 50px;
          cursor: pointer;
          position: relative;
        }

        .active {
          color: #12c1f1;
        }

        .active::after {
          content: "";
          width: 2px;
          height: 100%;
          display: inline-block;
          position: absolute;
          left: 50%;
          bottom: -20px;
          background: #09f768;
          transform: rotate(90deg);
        }
      }
    }
  }

  .header-search {
    .search-box {
      width: 240px;
      height: 40px;
      border-radius: 40px;
      background: #fff;
      position: relative;
      display: flex;
      align-items: center;
      padding: 0px 20px;
      .el-icon-search {
        margin-right: 10px;
        font-size: 18px;
        color: #000;
      }
      input {
        color: #000;
        width: 100%;
        height: 100%;
        border: 0;
      }
    }
  }
}

// 媒体查询 最小768px  - 最大1240px
@media screen and (min-width: 992px) and (max-width: 1240px) {
  .header-box {
    padding: 0 30px;
    .header-menu {
      font-size: 20px;
      .title {
        margin-right: 40px;
      }
    }
  }
}

// 媒体查询 最小769px  - 最大991px
@media screen and (min-width: 769px) and (max-width: 991px) {
  .header-box {
    padding: 0px 20px;

    .header-menu {
      font-size: 18px;

      .title {
        margin-right: 40px;
      }
      .list {
        .list-ul {
          li {
            margin-right: 30px;
          }
        }
      }
    }

    .header-search {
      .search-box {
        width: 200px;
        .el-icon-search {
          font-size: 16px;
        }
      }
    }
  }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  .header-box {
    padding: 0px 20px;

    .header-menu {
      font-size: 16px;
      .title {
        margin-right: 0px;
        display: none;
      }
      .list {
        .list-ul {
          li {
            margin-right: 30px;
          }
        }
      }
    }
    .header-search {
      .search-box {
        width: 160px;
        height: 30px;
        padding: 2px 10px;
        .el-icon-search {
          font-size: 14px;
          margin-right: 6px;
        }
        input {
          font-size: 14px;
        }
      }
    }
  }
}

// 最小屏幕
@media screen and (max-width: 480px) {
  .header-box {
    padding: 0 10px;
    height: 60px;
    .header-menu {
      font-size: 14px;

      .title {
        display: none;
      }

      .list {
        .list-ul {
          li {
            margin-right: 20px;
          }
        }
      }
    }

    .header-search {
      .search-box {
        width: 120px;
        height: 20px;
        padding: 2px 5px;
        .el-icon-search {
          font-size: 12px;
          margin-right: 4px;
        }
        input {
          font-size: 12px;
        }
      }
    }
  }
}
</style>
